#ifndef AUDIOPLAYERBACKEND_H
#define AUDIOPLAYERBACKEND_H

#include <QString>
#include <libmpd-1.0/libmpd/libmpd.h>
#include <QtCore/QString>
#include <QtCore/QVariant>
#include <QtCore/QObject>
#include <qdebug.h>
#include <QTimer>
#include "song.h"
#include "databackend.h"

enum audio_backend_features{
    AUDIO_BACKEND_INFO = 0x01,
    AUDIO_BACKEND_CONTROL = 0x02,
    AUDIO_BACKEND_ADVANCED_CONTROL = 0x04,
    AUDIO_BACKEND_PLAYLIST = 0x08,
    AUDIO_BACKEND_COLLECTION = 0x10,
};

class AudioPlayerBackend: public DataBackend
{
  public:
    virtual ~AudioPlayerBackend() {}
    virtual uint features() = 0;
    virtual QString identifier() {return QString("audioplayer");}

    //AUDIO_BACKEND_INFO
    virtual QString getCurrentSongTitle() = 0;
    virtual QString getCurrentSongArtist() = 0;
    virtual QString getCurrentSongAlbum() = 0;
    //virtual QString getCurrentSong() = 0;

    //AUDIO_BACKEND_CONTROL
    virtual bool isPlaying() = 0;
    virtual bool isPaused() = 0;

    //AUDIO_BACKEND_ADVANCED_CONTROL
    virtual uint getVolume() = 0;
    virtual int getElapsedTime() = 0;
    virtual bool getRandom() = 0;
    virtual bool getRepeat() = 0;

    //AUDIO_BACKEND_COLLECTION
    virtual QList<QString> getAllArtists() = 0;
    virtual QList<QString> getAllAlbums() = 0;
    virtual QList<Song*> * getAllSongs() = 0;
    virtual QList<QString> getAlbumsFromArtist(QString artist) = 0;
    virtual QList<Song*> * getSongsFromAlbum(Album * album) = 0;
    virtual QList<Song*> * getSongsFromArtist(Artist * artist) = 0;

signals:
    void randomStatusChanged(bool status);
    void repeatStatusChanged(bool status);
    void songChanged();
    void stateChanged(bool playing);

public slots:
    //AUDIO_BACKEND_CONTROL
    virtual bool play() = 0;
    virtual bool pause() = 0;
    virtual bool togglePause() = 0;
    virtual bool stop() = 0;
    virtual bool next() = 0;
    virtual bool prev() = 0;

    //AUDIO_BACKEND_ADVANCED_CONTROL
    virtual bool setVolume(int value) = 0;
    virtual bool seek(int sec) = 0;
    virtual bool setRandom(bool status) = 0;
    virtual bool toggleRandom() = 0;
    virtual bool setRepeat(bool status) = 0;
    virtual bool toggleRepeat() = 0;

    //AUDIO_BACKEND_PLAYLIST
    virtual bool play(uint id) = 0;
    virtual bool play(Song * song) = 0;

};

Q_DECLARE_INTERFACE(AudioPlayerBackend,"tsmpc.AudioPlayerBackend")

#endif // AUDIOPLAYERBACKEND_H
